//
// Created by sun on 2020/5/16.
//

#ifndef PX4_MESSAGE_TYPE_H
#define PX4_MESSAGE_TYPE_H



// TYPE:
//    GCS SEND :1 COMMAND 2 CURRENT_STATE 3 SETPOINT
//    UAV SEND :4 MESSAGE_BACK

//GCS SEND
// COMMADN:
//   FRAME:    0XFE+0X22+MESSAGE_TYPE+MODE+OFFBOARD_COMMAND+ARMED_COMMAND+TAKEOFF_COMMAND+BACK_INFO+SUMCHECK+0XEE

// CURRENT_STATE:
//   FRAME:    0XFE+0X22+MESSAGE_TYPE+CURRENT_STATE+6*INT(24*BYTE)/3*INT(12*BYTE)+SUMCHECK+0XEE

// SETPOINT:
//   FRAME:    OXFE+OX22+MESSAGE_TYPE+SETPOINT_TYPE+3*INT(X,Y,Z)(12*BYTE)/4*INT(R,P,Y,T)(16*BYTE)+SUMCHECK+OXEE

// UAVSEND
// FRAME:    0XFE+0X22+MESSAGE_TYPE+BACK_INFO+3*INT(X,Y,Z)(12*BYTE)/3*INT(R,P,y)(12*BYTE)+SUMCHECK+0XEE


#define SCALE 10000.0f

enum MESSAGE_TYPE : unsigned char{
    COMMAND = 0x01,
    CURRENT_STATE = 0x02,
    SETPOINT = 0x03,
    MESSAGE_BACK = 0x04
};

enum BACK_INFO : unsigned char{
    ONLY_POSITION = 0x05,
    ONLY_IMU = 0x06,
    POSITION_AND_IMU = 0x07,
    DO_NOTHING  = 0x08
};

enum SEND_CURRENT_STATE:unsigned char{
    SEND_NED_POSITION = 0x08,
    SEND_NED_RPY = 0x09,
    SEND_NED_POSITION_RPY = 0x10
};

enum MODE:unsigned char{
    VICON = 0x0A,
    GPS = 0x0B,
    CAMERA = 0x0C
};

enum OFFBOARD_COMMAND:unsigned char{
    OFF_DO_NOTHING = 0x01,
    STAY_IN = 0x02,
    STAY_OUT = 0x03,
    TRY_IN = 0x04,
    TRY_OUT = 0x05,
    ALT_IN = 0x06,
    POS_IN = 0x07
};

enum ARM_COMMAND:unsigned char{
    ARM_DO_NOTHING = 0x01,
    ARMED = 0x02,
    DISARMED = 0x03
};

enum TAKEOFF_COMMAND:unsigned char{
    TAKEOFF_DO_NOTHING = 0X01,
    TAKEOFF = 0x02,
    LAND = 0x03,
    EMER_LAN = 0x04
};

enum SETPOINT_TYPE:unsigned char{
    LOCAL_POSITION_SP = 0x01,
    GLOBAL_POSITION_SP = 0x02,
    ATTITUDE_SP = 0x03,
    VELOCITY_SP = 0x04
};

#endif //PX4_MESSAGE_TYPE_H
